<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div id="app">
        <h1>简单计算器</h1>
        <div>
            <span>数值A:</span>
            <span>
            <input type="number" v-model='a'>
          </span>
        </div>
        <div>
            <span>数值B:</span>
            <span>
            <input type="number" v-model='b'>
          </span>
        </div>
        <div>
            <button v-on:click='handle'>计算</button>
        </div>
        <div>
            <span>计算结果:</span>
            <span v-text='result'></span>
        </div>
    </div>
    <script src="js/vue.js"></script>
    <script src="js/floatobj.js"></script>
    <script>
        // 简单计算器案例
        var vm = new Vue({
            el: '#app',
            data: {
                a: '',
                b: '',
                result: ''
            },
            methods: {
                handle: function() {
                    // 实现计算逻辑
                    // this.result = parseFloat(this.a) + parseFloat(this.b);
                    this.result = floatObj.add(this.a, this.b, 2);
                }
            }
        });
    </script>

</body>

</html>